import { Plus, Search, UploadFilled, Setting, Unlock, Lock, Delete, Right, View, Edit, Download } from '@element-plus/icons-vue'
import AOS from 'aos'
import img3 from '@/assets/images/contract/3.png'
import img4 from '@/assets/images/contract/4.png'
import img5 from '@/assets/images/contract/5.png'
import img6 from '@/assets/images/contract/6.png'
import img7 from '@/assets/images/contract/7.png'
import img8 from '@/assets/images/contract/8.png'
import img9 from '@/assets/images/contract/9.png'
import img10 from '@/assets/images/contract/10.png'
import img12 from '@/assets/images/contract/12.png'
import img13 from '@/assets/images/contract/13.png'
import img14 from '@/assets/images/contract/14.png'
import img15 from '@/assets/images/contract/15.png'
import img16 from '@/assets/images/contract/16.png'
import img17 from '@/assets/images/contract/17.png'
import img18 from '@/assets/images/contract/18.png'
import img19 from '@/assets/images/contract/19.png'
import lixiang1 from '@/assets/images/contract/lixiang1.png'
import lixiang2 from '@/assets/images/contract/lixiang2.png'

import useSettingsStore from '@/store/modules/settings'
import useCommonsStore from '@/store/modules/common'

import paginationData from '@/hooks/paginationData'
import { localStorage, sessionStorage } from '@/utils/storage'

export default function commonData() {
    const route = useRoute()
    const router = useRouter()
    const settingsStore = useSettingsStore()
    const commonsStore = useCommonsStore()

    const { total, paginationQuery, changeLimit } = paginationData()
    const isPc = computed(() => settingsStore.mode === 'pc')
    const reload = inject('reload')

    function initAos() {
        setTimeout(() => {
            AOS.init({
                offset: 150,
                duration: 500,
                disable: false
                // easing: 'ease-in-sine'
            })
        }, 300)
    }

    // 初始化
    function setContractData(data) {
        const oldData = getContractData()
        sessionStorage.set('contractSessionData', { ...oldData, ...data })
    }
    // 初始化
    function getContractData() {
        return sessionStorage.get('contractSessionData')
    }

    const handleToContractDetails = row => {
        const data = {
            contractInitiationUuId: row.contractInitiationUuId,
            projectName: row.projectName,
            projectId: row.projectId,
            gllxid: row.gllxid
        }
        setContractData(data)
        router.push({ path: '/contract' })
    }

    return {
        Search, UploadFilled, Setting, Unlock, Lock, Delete, Right, Plus, View, Edit, Download,
        localStorage, sessionStorage,
        initAos, AOS,
        setContractData, getContractData,
        handleToContractDetails,
        route, router,
        settingsStore, isPc, commonsStore,
        total, paginationQuery, changeLimit,
        img3, img4, img5, img6, img7, img8, img9, img10, img12, img13, img14, img15, img16, img17, img18, img19, lixiang1, lixiang2,
        reload
    }
}
